<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
    </el-breadcrumb>
    <el-carousel :interval="2000" height="400px" direction="vertical" :autoplay="true" class="margintop20">
      <el-carousel-item v-for="(tu,i) in banner" :key="i">
        <img class="img" :src="tu.imgUrl" alt />
        <!-- <p class="pp">{{tu.text}}</p> -->
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import { gethomebanner } from "@/api";
import {mapState,mapMutations} from "vuex"
export default {
  data() {
    return {
      // banner: [],
    };
  },
  computed:{
    ...mapState(['banner'])
  },
  methods:{
    ...mapMutations(['changebanner'])
  },
  mounted() {
    if(!this.banner){
      gethomebanner()
      .then((res) => {
      if (res.type) {
        // this.banner = res.result;
        console.log(11111);
        this.changebanner(res.result)
      }
    });
    }
  },
};
</script>

<style lang="scss" >
.img {
  width: 100%;
  height: 100%;
}
.pp {
  position: absolute;
  font-size: 18px;
  // color: #fff;
  line-height: 36px;
  background-color: #aa0528;
  left: 40px;
  bottom: 30px;
  padding: 0 1em;
}
.el-breadcrumb__inner{
  font-size: 20px;
}
</style>